package com.xbongbong.pro.sheet.pojo;

import com.xbongbong.saas.enums.XbbRefTypeEnum;
import com.xbongbong.saas.enums.business.OtherExpenseEnum;
import com.xbongbong.saas.enums.business.OtherIncomeEnum;
import com.xbongbong.saas.enums.business.PaySheetEnum;
import com.xbongbong.saas.enums.business.PaymentSheetEnum;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;

/**
 * 回款单/付款单的字段attr pojo
 * @author zcp
 * @version v1.0
 * @since v1.0
 */
@Getter
@Setter
@ToString
public class SheetAttrPojo implements Serializable {
    private static final long serialVersionUID = -5373912382911577146L;

    /**
     * 业务类型
     */
    private XbbRefTypeEnum xbbRefTypeEnum;
    /**
     * 回款单/付款单类型 字段attr
     */
    private String attrSheetType;
    /**
     * 回款金额/付款金额 字段attr
     */
    private String attrAmount;
    /**
     * 核销金额 字段attr
     */
    private String attrWriteOffAmount;
    /**
     * 关联客户/关联供应商 字段attr
     */
    private String attrCustomer;
    /**
     * 关联合同/关联采购合同 字段attr
     */
    private String attrCon;
    /**
     * 关联合同隐藏/关联采购合同隐藏 字段attr
     */
    private String attrConLink;
    /**
     * 关联应收款/关联付款计划 字段attr
     */
    private String attrPlan;
    /**
     * 关联应收款隐藏/关联付款计划隐藏 字段attr
     */
    private String attrPlanLink;
    /**
     * 归属人 字段attr
     */
    private String attrBelongId;

    public SheetAttrPojo(XbbRefTypeEnum xbbRefTypeEnum) {
        this.xbbRefTypeEnum = xbbRefTypeEnum;
        switch (xbbRefTypeEnum) {
            case OTHER_INCOME:
                this.attrSheetType = OtherIncomeEnum.SHEET_TYPE_OTHER.getAttr();
                this.attrAmount = OtherIncomeEnum.AMOUNT.getAttr();
                this.attrBelongId = OtherIncomeEnum.BELONG_ID.getAttr();
                break;
            case OTHER_EXPENSE:
                this.attrSheetType = OtherExpenseEnum.SHEET_TYPE_OTHER.getAttr();
                this.attrAmount = OtherExpenseEnum.AMOUNT.getAttr();
                this.attrBelongId = OtherExpenseEnum.BELONG_ID.getAttr();
                break;
            case PAY_SHEET:
                this.attrSheetType = PaySheetEnum.PAY_SHEET_TYPE.getAttr();
                this.attrAmount = PaySheetEnum.AMOUNT.getAttr();
                this.attrWriteOffAmount = PaySheetEnum.WRITE_OFF_AMOUNT.getAttr();
                this.attrCustomer = PaySheetEnum.LINK_SUPPLIER.getAttr();
                this.attrCon = PaySheetEnum.LINK_PURCHASE.getAttr();
                this.attrConLink = PaySheetEnum.PURCHASE_LINK_TEXT.getAttr();
                this.attrPlan = PaySheetEnum.PAY_PLAN.getAttr();
                this.attrPlanLink = PaySheetEnum.PAY_PLAN_LINK_TEXT.getAttr();
                this.attrBelongId = PaySheetEnum.BELONG_ID.getAttr();
                break;
            default:
                this.attrSheetType = PaymentSheetEnum.PAYMENT_SHEET_TYPE.getAttr();
                this.attrAmount = PaymentSheetEnum.AMOUNT.getAttr();
                this.attrWriteOffAmount = PaymentSheetEnum.WRITE_OFF_AMOUNT.getAttr();
                this.attrCustomer = PaymentSheetEnum.CUSTOMER_ID.getAttr();
                this.attrCon = PaymentSheetEnum.CONTRACT.getAttr();
                this.attrConLink = PaymentSheetEnum.CONTRACT_LINK_TEXT.getAttr();
                this.attrPlan = PaymentSheetEnum.PAYMENT.getAttr();
                this.attrPlanLink = PaymentSheetEnum.PAYMENT_LINK_TEXT.getAttr();
                this.attrBelongId = PaymentSheetEnum.BELONG_ID.getAttr();
                break;
        }
    }
}
